package cn.ilikes.tools.nosql.jpa.classloads;

public class URLPathFilterLoadResources extends URLPathLoadResources {

	private ClassFilter filter;

	public URLPathFilterLoadResources(ClassFilter filter) {
		this.filter = filter;
	}

	@Override
	public void loadedResources(String resourcesName, byte[] resources, ResourcesType resourcesType) {
		if (resourcesType.equals(ResourcesType.classes))
			resourcesName = resourcesName.substring(0, resourcesName.lastIndexOf(".class"));
		if (filter.isFilter(resourcesName, resourcesType)) {
			filter.filter(resourcesName, resources);
		}
	}

}